package com.dyw.mybatisplus06plugin.Config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.apache.ibatis.annotations.Mapper;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Devil
 * @create 2022-01-23-13:10
 *
 *
 * @Configuration标注的类就相当于xml配置文件
 */
@Configuration
@SuppressWarnings("all")
//@MapperScan("com.dyw.mybatisplus06plugin.mapper")
public class MybatisPlusConfig {
    /**
     * 定义方法,返回值时java对象 这个对象是放入到spring容器中的
     * 使用过@Bean修饰方法
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }

}
